package com.hikvision.rpq.sblearn.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author renpeiqian
 * @date 2021/9/7 14:59
 * @since
 */
@Slf4j
public class MyFilter  implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        int localPort = servletRequest.getLocalPort();
        log.info("记录请求端口：{}",localPort);
        filterChain.doFilter(servletRequest,servletResponse);
        log.info("记录响应日志");
    }

    @Override
    public void destroy() {

    }
}
